(1) Field of the Invention
The present invention relates to a memory patching device for a computer system, and more particularly, to a memory patching device for automatically changing part of an object program stored in a main memory.
(2) Description of the Related Art
Binary-coded object programs executable by a computer system are created in the following manner. First, source programs are compiled using a compiler, to prepare object modules. Then, using a linker, the object modules are combined with necessary libraries to produce object programs.
Object programs created in this manner are generally constructed in a dynamically relocatable fashion. Thus, when an object program stored in an external storage such as a hard disk is executed, an operating system (OS) loads the object program into the main memory while relocating the object program, or more specifically, while converting address information contained in the object program. The OS then sets registers in the processor necessary to execute the object program.
In cases where a created object program contains a bug, or some constant value or the like to be corrected, the object program need be temporarily modified without changing the source program. Such operation, or temporary change of part of an object program, is called "patching."
Patching an object program, however, requires expert knowledge of computer systems. Therefore, usually a patch program is supplied to common users of computer systems so that object programs requiring correction can be automatically patched by the patch program, thus allowing users to remove bugs or correct constant values etc.
Conventionally, the patch program is separate from an object program, and the object program is patched by one of the following two methods:
In the first method, an object program stored in the external storage or the like is directly patched. Namely, the object program is patched before it is loaded into the main memory.
In the second method, when an object program is loaded into the main memory, the patch program retrieves patch information associated with the object program, from patch information stored in the external storage or the like, and patches the object program in accordance with the retrieved patch information, as disclosed in Unexamined Japanese Patent Publication (KOKAI) No. 63-115234.
Thus, bugs, erroneous constant values or the like in object programs can be automatically corrected without troubling users of computer systems.
However, in the first method, the patch process must be monitored all the time to determine whether the object program requires patching, and if the monitoring is carried out improperly, the patch process fails to be executed. Thus, the monitoring consumes labor.
The second method poses no particular problem if the object program is loaded statically in the main memory. In many of existing computers, however, object programs are dynamically linked, and the addresses of object programs change when the programs are loaded into the main memory. Thus, the location of data of an object program to be patched changes, making the patch process unfeasible.